package com.iwhalecloud.uncc.dao.impl;

import com.iwhalecloud.uncc.dao.ArchiverDao;
import com.iwhalecloud.uncc.model.InsCollectService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author zq
 * @date 2021/10/20 19:11
 * @description
 */
@Slf4j
@Repository("insCollectServiceArchiverDao")
public class InsCollectServiceArchiverDaoImpl implements ArchiverDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public Object query(Object o) {
        return null;
    }

    /**
     * List
     * @param o
     * @return
     */
    @Override
    public List queryList(Object o) {
        StringBuilder sql = new StringBuilder("SELECT");
        sql.append(" `COLL_SERVICE_ID`, `SERVICE_CODE`, `ABSTRACT_ID`, `COMPONENT_ID`, `SERVICE_NAME`, `REGISTER_DATE`, `INTERRUPT_TIME`, `STATE`, `ACTIVE_STATE`, `SPECIALTY`, `VENDOR`, `PROVINCE_ID`, `AREA_ID`, `VERSION`, `IP`, `PORT`, `CPU_TOTAL`, `MEMORY_TOTAL`, `DISK_TOTAL`, `IO_WAIT`, `HEARTBEAT_INTERVAL`, `SERVERPERF_INTERVAL`, `TIME_STAMP`, `DESCRIPTION`, `MAX_THREAD_NUM`, `MEMORY_STAT`, `DISK_STAT`, `CPU_FREQUENCY`, `CORE`, `RAM`, `ROM`, `CREATE_DATE`, `UPDATE_DATE`, `APP_NAME`, `TITLE`, `SEQ`, `ADDRESS_TYPE`, `ADDRESS_LIST`, `IO_STAT`");
        sql.append(" FROM INS_COLLECT_SERVICE");
        List<InsCollectService> list = jdbcTemplate.query(sql.toString(),
                new BeanPropertyRowMapper<>(InsCollectService.class));
        if(!list.isEmpty()){
            return list;
        }
        return null;
    }

    @Override
    public List batchQuery(List list) {
        return null;
    }

    @Override
    public void insert(Object o) {

    }

    @Override
    public void batchInsert(List list) {

    }

    @Override
    public void update(int flag, Object o) {

    }

    @Override
    public void batchUpdate(int flag, List list) {

    }

    @Override
    public void delete(Object o) {

    }

    @Override
    public void batchDelete(List list) {

    }
}
